package com.situ.controller;

import com.situ.domain.vo.MenuListVO;
import com.situ.service.MenuService;
import com.situ.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

@Slf4j
@RestController
@RequestMapping("/menu")
@Tag(name = "菜单接口")
@RequiredArgsConstructor
public class MenuController {

    private final MenuService menuService;

    @GetMapping("/getAllMenuList")
    @Operation(summary = "获取全部菜单列表")
    public Result<List<MenuListVO>> getAllMenuList(){
        List<MenuListVO> menuListVOs = menuService.getAllMenuList();
        return Result.success(200,"获取菜单列表成功",menuListVOs);
    }


    @GetMapping("/getMenuByManager")
    @Operation(summary = "获取当前登录用户的菜单列表")
    public Result<Set<MenuListVO>> getMenuByManager () {
        log.info("获取当前登录用户的菜单列表");
        Set<MenuListVO> menuListVOs = menuService.getMenuByManager();
        return Result.success(200, "获取菜单列表成功", menuListVOs);
    }

}
